oo::class create PopupIndentationDialog {
    superclass PopupDialog
    variable Path PopUpFlag OKVal CancelVal ifDestroy

    method createPopup {msg} {
        next $msg

        frame $Path.indentation
        label $Path.indentation.lb -text {Space count}
        ttk::spinbox $Path.indentation.sb -from 1 -to 10 -validate key -validatecommand {string is integer %P} -width 3

        pack $Path.indentation.lb $Path.indentation.sb -side left
        pack $Path.indentation -side top

        foreach cls [info class subclasses ::Language] {
            set obj [lindex [info class instances $cls] 0]
            if {$obj != {}} { break }
        }
        $Path.indentation.sb set [string length [$obj getTabSpacing]]
    }

    method turnOnFlag {} {
        set spaceCount [$Path.indentation.sb get]
        foreach cls [info class subclasses ::Language] {
            foreach obj [info class instances $cls] {
                oo::objdefine $obj method getTabSpacing {} [subst {
                    return \[string repeat { } $spaceCount\]
                }]
            }
        }
    }
}
